package com.myrock.zlbandy.gorock.rock.z;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by zlbandy on 2017/9/10.
 */

public class MyShare {
    private SharedPreferences.Editor editor;
    private SharedPreferences userInfo;

    public MyShare(Context context){
        userInfo = context.getSharedPreferences("userInfo", 0);
        editor=userInfo.edit();
    }

    public int Getlogin(){
        return userInfo.getInt(userInfo.getString("user",""),0);
    }

    public String Getname(){
        return userInfo.getString("user","");
    }


    public void adduser(String username,int head){
        editor.putString("user",username);
        editor.putInt(username,head);
        editor.commit();
    }

    public void addopen(){
       editor.putBoolean("isopen",true);
        editor.commit();
    }

    public boolean getOpen(){
        return userInfo.getBoolean("isopen",false);
    }


    public void clear(){
        editor.clear();
        editor.commit();
    }
}
